function doFilterWork(masterComboId, detailComboId) {
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        if (parentCombo) {
            if (detailComboId) {
                var url = "http://b2net1.home.pl/Ajax/FilterApplDetailAjax.aspx?typeId=" + parentCombo.value;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split(",");
                                if (options[0] != "")
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideCombo(detailComboId);
                        } //if
                    } //if state
                } //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function doModelWork(masterComboId, detailComboId) {
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        if (parentCombo) {
            if (detailComboId) {
                var url = "http://b2net1.home.pl/Ajax/ModelApplDetailAjax.aspx?filterId=" + parentCombo.value;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split(",");
                                if (options[0] != "")
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideCombo(detailComboId);
                        } //if
                    } //if state
                }              //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function doTypeWork(masterComboId, detailComboId) {
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        var filterId = document.getElementById("filterDropDown").value;
        if (parentCombo) {
            if (detailComboId) {
                var url = "http://b2net1.home.pl/Ajax/TypeApplDetailAjax.aspx?filterId=" + filterId +"&makeId=" + parentCombo.value;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split(",");
                                if (options[0] != "")
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideCombo(detailComboId);
                        } //if
                    } //if state
                }              //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function doEngineWork(masterComboId) {
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var filterId = document.getElementById("filterDropDown").value;
                var url = "http://b2net1.home.pl/Ajax/EngineApplDetailAjax.aspx?filterId=" + filterId + "&modelId=" + masterComboId.value;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var response = httpObject.responseText;
                        jQuery("#searchLeftSide").show();
                        jQuery("#searchLeftSide").html(response);
                    } //if state
                }                 //func
                httpObject.send(null);
    } //if
}

function clearCombo(comboId) {
    if (comboId) {
        var comboToClear = document.getElementById(comboId);
        if (comboToClear) {
            comboToClear.options.length = 0;
            comboToClear.options[0] = new Option("---", -1);
        } //if
    } //if
}

function showHideCombo(comboId) {
    if (comboId) {
        var item = document.getElementById('div' + comboId);
        if (item) {
            var comboToShowHide = document.getElementById(comboId);
            if (comboToShowHide) {
                if (comboToShowHide.options) {
                    if (comboToShowHide.options.length <= 1) {
                        item.style.display = 'none';
                    } else {	//if
                        item.style.display = 'block';
                    } //else
                } //if
            } //if
        } //if
    } //if
}